Project

General

Profile

Actions

Bug #98197

closed

Undefined array key in form variants if variable of variant condition is empty

Added by Lidia Demin about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2022-08-24
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.0
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I have a radio "contactType" with default value preset. Depending on the contact type I want to add dynamic validation to following input fields (email, phone, ...). The configuration looks like this:

                  -
                    identifier: contactType
                    type: RadioButton
                    defaultValue: email
                    properties:
                      optionClass: c7of24
                      options:
                        email: 'E-Mail'
                        phone: 'Telefon'
                        mail: 'Post'
                  -
                    identifier: email
                    type: Text
                    properties:
                      type: email
                    variants:
                      - identifier: contactType-email
                        condition: 'formValues["contactType"] == "email"'
                        validators:
                          - identifier: NotEmpty
                          - identifier: EmailAddress

Sadly, I get the following Exception on the initial form call:

PHP Warning: Undefined array key "contactType" in /var/www/html/www/vendor/symfony/expression-language/Node/GetAttrNode.php line 97

Running TYPO3 11.5 with PHP 8.0.


Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Bug #95781: PHP Warning: Undefined array key "uid" in /app/vendor/symfony/expression-language/Node/GetAttrNode.phpRejected2021-10-26

Actions
Related to TYPO3 Core - Bug #97624: Undefined array key "module" - /symfony/expression-language/Node/GetAttrNode.php line 97Closed2022-05-13

Actions
Related to TYPO3 Core - Bug #94707: Undefined array key / Trying to access array offset on value of type null / PHP Version 8.0.8Closed2021-08-04

Actions
Actions #1

Updated by Lidia Demin about 2 years ago

Seems like the cause is somewhere deeper. There are various issues with conditions if the offset value doesn't exist, e.g. #95781 or #97624

For now, I have the following workaround:

condition: 'traverse(formValues, "contactType") == "email"'

Maybe this helps someone. Thanks to Stefan Bürk for pointing me this way.

Actions #2

Updated by Georg Ringer about 2 years ago

  • Related to Bug #95781: PHP Warning: Undefined array key "uid" in /app/vendor/symfony/expression-language/Node/GetAttrNode.php added
Actions #3

Updated by Georg Ringer about 2 years ago

  • Related to Bug #97624: Undefined array key "module" - /symfony/expression-language/Node/GetAttrNode.php line 97 added
Actions #4

Updated by Oliver Hader about 2 years ago

  • Status changed from New to Closed

Duplicate of #95781 → please continue there

Actions #5

Updated by Felix Nagel almost 2 years ago

  • Related to Bug #94707: Undefined array key / Trying to access array offset on value of type null / PHP Version 8.0.8 added
Actions

Also available in: Atom PDF